<form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
  <!-- <nz-form-item>
    <nz-form-label [nzSpan]="6" nzRequired>
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.DisplayName' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <input 
        nz-input 
        formControlName="displayName" 
        [placeholder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.DisplayName' | abpLocalization" 
      />
    </nz-form-control>
  </nz-form-item> -->
  <nz-form-item>
    <nz-form-label [nzSpan]="6" nzRequired>
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.Version' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <input 
        nz-input 
        formControlName="version" 
        [placeholder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.Version' | abpLocalization" 
      />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="6" nzRequired>
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ItemMasterId' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <widget-entity-ref-select
          formControlName="itemMasterId" 
          [placeholder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ItemMasterId' | abpLocalization"
          [idKey]="'id'"
          [labelKey]="'name'"
          [showSelect]="showItemMasterSelect"
          [getDetail]="getItemMasterDetail"
          (selectedValueChanged)="onItemMasterSelect($event)"
          readonly
        >
        </widget-entity-ref-select>
    </nz-form-control>
  </nz-form-item>  
  <nz-form-item>
    <nz-form-label [nzSpan]="6" nzRequired>
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ItemCode' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <input 
        nz-input 
        formControlName="itemCode" 
        [placeholder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ItemCode' | abpLocalization" 
        [readonly]="true"
      />
    </nz-form-control>
  </nz-form-item>  
  <nz-form-item>
    <nz-form-label [nzSpan]="6" nzRequired>
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ItemName' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <input 
        nz-input 
        formControlName="itemName" 
        [placeholder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ItemName' | abpLocalization" 
        [readonly]="true"
      />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="6">
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ItemSpec' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <input 
        nz-input 
        formControlName="itemSpec" 
        [placeholder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ItemSpec' | abpLocalization" 
        [readonly]="true"
      />
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="6" nzRequired>
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.UseCount' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <nz-input-number
        formControlName="useCount"       
        [nzPlaceHolder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.UseCount' | abpLocalization"
        [nzMin]="0"
        [nzPrecision]="4"
        style="width: 100%;">
      </nz-input-number>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="6" nzRequired>
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ParentCount' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <nz-input-number
        formControlName="parentCount"       
        [nzPlaceHolder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.ParentCount' | abpLocalization"
        [nzMin]="0"
        [nzPrecision]="4"
        style="width: 100%;">
      </nz-input-number>
    </nz-form-control>
  </nz-form-item>
  <nz-form-item>
    <nz-form-label [nzSpan]="6" nzRequired>
      {{ 'BasicArchives::ModelTitle:Joy.Erp.BasicArchives.ItemMasters.BillOfMaterials.UnitId' | abpLocalization }}
    </nz-form-label>
    <nz-form-control [nzSpan]="16" nzHasFeedback [nzErrorTip]="errorTpl">
      <widget-entity-ref-select
      formControlName="unitId" 
        [placeholder]="'BasicArchives::ModelPlaceHolder:Joy.Erp.BasicArchives.Asns.AsnLine.UnitId' | abpLocalization"
        [idKey]="'id'"
        [labelKey]="'unit.displayName'"
        [showSelect]="getShowUnitSelect"
        [getDetail]="getUnitDetail"
      >
      </widget-entity-ref-select>
    </nz-form-control>
  </nz-form-item>
</form>

<ng-template #errorTpl let-control>
  <ng-container *ngIf="control.hasError('required')">
    {{ 'BasicArchives::UI:Validation:Required' | abpLocalization }}
  </ng-container>
  <ng-container *ngIf="control.hasError('maxlength')">
    {{ 'BasicArchives::UI:Validation:MaxLength' | abpLocalization: control.getError('maxlength').requiredLength }}
  </ng-container>
</ng-template>

<div *nzModalFooter>
  <button nz-button nzType="default" (click)="cancelForm()">
    {{ 'BasicArchives::UI:SimplyTree.RefEntity.Cancel' | abpLocalization }}
  </button>
  <button nz-button nzType="primary" (click)="submitForm()" [disabled]="!validateForm.valid">
    {{ 'BasicArchives::UI:SimplyTree.RefEntity.Submit' | abpLocalization }}
  </button>
</div>
